<?php
my_component_load('testing' , false);
my_component_load('paging' , false); 
my_component_load('data_setting', false); 
my_component_load('struktur_gaji' );
$task = isset($_GET['task']) ? $_GET['task'] : "";  
$id = isset( $_GET['id'] ) ? $_GET['id']:  0;
$sid = isset( $_GET['sid'] ) ? $_GET['sid']:  0;
$sgi = isset( $_GET['sgi'] ) ? $_GET['sgi']:  0;
$modulname = "Admin _BN_ Konfigurasi Data";

if($_SERVER['REQUEST_METHOD'] == "POST"){
	if($task == 'edit_data_page'){
		$validate = add_data_validate($id, $sid );
		if($validate){
			$errors = message_multi_error($validate);
			$content = $errors;
			$content .= add_data($id , $sid);
			generate_my_web($content, $pagename,'plain.php' );
			exit;
		}else{
			add_data_submit( $id , $sid );
			generate_my_web("Updated", $pagename,'plain.php' );
			exit;
		}	
	}
	elseif($task == 'edit_tahun_page'){
		$validate = add_tahun_validate($id);
		if($validate){
			$errors = message_multi_error($validate);
			$content = $errors;
			$content .= add_tahun($id);
			generate_my_web($content, $pagename,'plain.php' );
			exit;
		}else{
			add_tahun_submit( $id );
			generate_my_web("Updated", $pagename,'plain.php' );
			exit;
		}
	}
}else{
	if($task == 'struktur_detail'){
		load_facebox_script();
		$data =my_get_data_by_id('pr_struktur_gaji_tahun','struktur_gaji_id',$sid);
		$pagename = "Tabel Struktur Gaji"; 
		$view = struktur_gaji_detail($sid);
		$href = 'index.php?com='.$_GET['com'].'&task=edit_data&sid='.$sid.'&id=0' ;	
	}elseif($task == 'edit_data'){
		$title=   "Data struktur gaji"  ;
		facebox_page('index.php?com='.$_GET['com'].'&task=edit_data_page&id='.$id.'&sid='.$sid , $title , 220	); 
	}elseif($task == 'edit_data_page'){
		$content = add_data($id , $sid);
		generate_my_web($content, $pagename,'plain.php' );
		exit;
	}elseif($task == 'delete_detail'){
		delete_detail($id);
		my_direct($_SERVER['HTTP_REFERER']);		
	}elseif($task == 'edit_tahun')	{
		$title=   "Data tahun struktur gaji"  ; 
		facebox_page('index.php?com='.$_GET['com'].'&task=edit_tahun_page&id='.$id , $title , 220	); 
	}elseif($task == 'edit_tahun_page'){
		$content = add_tahun($id);
		generate_my_web($content, $pagename,'plain.php' );
		exit;
	}elseif($task == 'auto'){
		auto_grade($sid);
		my_direct($_SERVER['HTTP_REFERER']);	
	}elseif($task == 'delete'){
		delete_struktur($sid);
		my_direct($_SERVER['HTTP_REFERER']);
	}else{
		$pagename = "Daftar SK Struktur Gaji"; 
		load_facebox_script();	
		$view = list_tahun_struktur();		
		$href = 'index.php?com='.$_GET['com'].'&task=edit_tahun&id=0' ;	
	}	
}
$content = spliter_browser( $view , $pagename ,$href);
generate_my_web($content, $modulname." _BN_ Struktur Gaji" );

?>